package com.hanthink.common.enums;

import com.hanthink.common.utils.StringUtils;

import java.util.Arrays;
import java.util.List;

/**
 * 隐患枚举类
 *
 * @author WangBin
 * @since 2025-10-25
 */
public enum HiddenDangerType {
    MAJOR_HIDDEN_DANGER("1", "重大隐患"),
    NOT_MAJOR_HIDDEN_DANGER("2", "非重大隐患"),
    NOT_HIDDEN_DANGER("3", "不是隐患");

    private String type;
    private String value;

    HiddenDangerType(String type, String value) {
        this.type = type;
        this.value = value;
    }

    public String getType() {
        return type;
    }

    public String getValue() {
        return value;
    }

    public static HiddenDangerType valueByType(String type) {
        if (StringUtils.isEmpty(type)) {
            return null;
        }
        for (HiddenDangerType pushTypeEnum : HiddenDangerType.values()) {
            if (pushTypeEnum.getType().equals(type)) {
                return pushTypeEnum;
            }
        }
        return null;
    }

    public static String getValue(String type) {
        if (StringUtils.isEmpty(type)) {
            return null;
        }
        for (HiddenDangerType pushTypeEnum : HiddenDangerType.values()) {
            if (pushTypeEnum.getType().equals(type)) {
                return pushTypeEnum.value;
            }
        }
        return null;
    }
}